package com.snow.useviewdemo.function2.constraint

import android.os.Bundle
import android.view.View
import android.widget.Toast
import com.snow.useviewdemo.APPApplication
import com.snow.useviewdemo.R
import com.snow.useviewdemo.base.BaseKotlinActivity
import kotlinx.android.synthetic.main.activity_constraint_layout.*

/**
 * Created by zhaoyingtao
 * Date: 2020/10/10
 * Describe:测试约束布局
 */
class ConstraintLayoutTestActivity : BaseKotlinActivity() {
    override fun getLayoutId(): Int {
        return R.layout.activity_constraint_layout
    }

    private var isShowImageView: Boolean = false
    private var isShowTextView: Boolean = false
    override fun setViewData(savedInstanceState: Bundle?) {
        tv1.text = "布局的显示"
        btn01.setOnClickListener {
            acl_textView?.visibility = View.VISIBLE
            isShowImageView = !isShowImageView
            if (isShowImageView) {
                acl_imageView?.visibility = View.VISIBLE
            } else {
                acl_imageView?.visibility = View.GONE
            }
        }
        btn02.setOnClickListener {
            acl_imageView?.visibility = View.VISIBLE
            isShowTextView = !isShowTextView
            if (isShowTextView) {
                acl_textView?.visibility = View.VISIBLE
            } else {
                acl_textView?.visibility = View.GONE
            }
        }
    }

    fun insideMethod() {
        Toast.makeText(APPApplication.getInstance(), "ssd", Toast.LENGTH_LONG).show()
    }

    companion object {
        fun outMethod() {
            Toast.makeText(APPApplication.getInstance(), "ssd", Toast.LENGTH_LONG).show()
        }
    }
}